<?php

namespace App\Traits\Relation;

use App\Models\Bills;
use App\Models\Network;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;

/**
 * 用于定义共派管理员账户和其他模型的关系
 *
 * @package App\Traits\Relation
 * Date: 2018/06/11
 * @author Tenny
 */
trait StationBillsRelation
{
    /**
     * 获取关联站的详细账单
     *
     * Date: 2018/06/11
     * @author Tenny
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function bills()
    {
        return $this->HasMany(Bills::class, 'service_id', 'service_id')->orderBy('date');
    }
}
